JBoss Messaging EJB3 Message Driven Bean Example

$Revision: 82920 $

Overview


This example deploys a simple EJB3 Message Driven Bean that processes messages sent to a test queue.  Once it receives a message and "processes" it, the EJB3 MDB sends an acknowledgment message to a  temporary destination created by the sender for this purpose. The example is considered  successful if the sender receives the acknowledgment message.


Running the example

1. Set up the JBOSS_HOME environment variable to point to the JBoss instance you deployed JBoss Messaging into. For example, if you deployed JBoss Messaging in C:\jboss-5.0.0.GA\server\default\messaging then your JBOSS_HOME value should be C:\jboss-5.0.0.GA


2. Go to the example's home directory

cd ...\examples\ejb3mdb

3. Run the example:

ant


The output of a successful run should be similar to:


$ ant
Buildfile: build.xml

identify:
     [echo] XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
     [echo] X                     Running the EJB3 MDB example                        X
     [echo] XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
     [echo] The queue: testQueue

sanity-check:

init:
    [mkdir] Created dir: C:\work\src\cvs\jboss-head\jms\docs\examples\ejb3mdb\output\classes\META-INF
    [mkdir] Created dir: C:\work\src\cvs\jboss-head\jms\docs\examples\ejb3mdb\output\lib\META-INF
    [mkdir] Created dir: C:\work\src\cvs\jboss-head\jms\docs\examples\common\output

compile:
    [javac] Compiling 2 source files to C:\work\src\cvs\jboss-head\jms\docs\examples\common\output
    [javac] Compiling 2 source files to C:\work\src\cvs\jboss-head\jms\docs\examples\ejb3mdb\output\classes

jar:
      [jar] Building jar: C:\work\src\cvs\jboss-head\jms\docs\examples\ejb3mdb\output\lib\mdb-example.ejb3

deploy:
     [copy] Copying 1 file to C:\work\src\jboss-4.0.3SP1-src\build\output\jboss-4.0.3SP1\server\default\deploy

sleep:
     [echo] Sleeping for 5 seconds ...

run:

send:
     [java] Queue /queue/testQueue exists
     [java] The Hello! message was successfully sent to the testQueue queue
     [java] Received message: !olleH
     [java] The example connected to JBoss Messaging version 1.4.1.GA (1.4)

     [java] #####################
     [java] ###    SUCCESS!   ###
     [java] #####################

undeploy:
   [delete] Deleting: C:\work\src\jboss-4.2.0.GA\build\output\jboss-4.0.3SP1\server\messaging\deploy\mdb-example.ejb3

BUILD SUCCESSFUL
Total time: 10 seconds


Troubleshooting


2. I get "javax.jms.JMSSecurityException: User null is NOT authenticated"

You probably didn't install JBoss Messaging correctly. A fresh JBoss Messaging installation requires changes in the security configuration of a default JBoss instance, specifically a properly configured "messaging" security domain.  Follow the instructions from the "Installation" paragraph of the release documentation.